package com.hxx.controller;

import com.hxx.ai.ChatAsissist;
import dev.langchain4j.model.chat.ChatLanguageModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OneController {
    @Autowired
    private ChatLanguageModel chatLanguageModel;

    @GetMapping("/chat")
    public String chat(String prompt){
        return chatLanguageModel.generate(prompt);
    }

    @Autowired
    private ChatAsissist chatAsissist;

    @GetMapping("/chatAsissist")
    public String chatAsissist(String prompt){
        return chatAsissist.chat(prompt);
    }

    @GetMapping("/chatAsissist2")
    public void chatAsissist2(){
        String chat = chatAsissist.chat("你好，我是张三");
        System.out.println(chat);
        String chat1 = chatAsissist.chat("我的名字叫什么");
        System.out.println(chat1);
    }
}